package c15IO;

import java.io.*;

/**
 * <p>
 *
 * @author: Yuanwl
 * @date: 2021/4/5 16:46
 */
public class 不关闭文件流测试 {
    public static void main(String[] args) throws InterruptedException {
        for (int i=0; i<100000; i++)
            rw("files/no_close_test.txt");
//        System.err.println(System.getProperties());
        Thread.sleep(100000);
    }

    private static int rw(String filePath) {
        try {
            String fn = System.getProperty("user.dir") + "/java7-and-before/" + filePath;
            FileInputStream stream = new FileInputStream(fn);
            BufferedReader bufRead = new BufferedReader(new InputStreamReader(stream));
            String line;
            while ((line = bufRead.readLine()) != null) {
                System.err.println(line);
            }
            return 1;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return 0;
    }

}
